package com.tbit.main.controller;

import com.tbit.main.common.JsonResult;
import com.tbit.main.pojo.VO.*;
import com.tbit.main.service.UpKeepService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * @author yao
 * @since 2025/1/22 17:22
 */
@RestController
@RequestMapping("/upkeep")
public class UpKeepController {

    @Resource
    private UpKeepService upKeepService;


    @RequestMapping("/list")
    public JsonResult<List<UpKeepRespVO>> list(UpKeepQueryReqVO reqVO) {

        List<UpKeepRespVO> list = upKeepService.getList(reqVO);

        return JsonResult.succ(list);
    }

    @PostMapping("/putUpkeep")
    public JsonResult<UpKeepPutMachineRespVO> putUpkeep(@Valid PutMachineReqVO reqVO) {
        return JsonResult.succ(upKeepService.putUpkeep(reqVO));
    }

    @PostMapping("/batchUpkeep")
    public JsonResult<List<PutMachineRespVO>> batchUpkeep(@Valid UpKeepReqVO reqVO) {
        return JsonResult.succ(upKeepService.batchUpkeep(reqVO));
    }

}
